﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TransCode.Logic;
using TransCode.Entitys;

namespace TransCode.Player.VideoPage
{
    /// <summary>
    /// Interaction logic for VideoMainPage.xaml
    /// </summary>
    public partial class VideoMainPage : Page
    {
        VideoLogic videoLogic = new VideoLogic();

        public VideoMainPage()
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(VideoMainPage_Loaded);
        }



        void VideoMainPage_Loaded(object sender, RoutedEventArgs e)
        {
            //videoList.ItemsSource = videoLogic.VideoList();
        }

        Video _video = null;

        private void videoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                Play(e.AddedItems[0] as Video);
            }
        }

        public void Play(Video video)
        {
            _video = video;
            videoPlayer.Play(_video);
            targetListControl1.SetVideoSource(_video, videoPlayer);
        }
    }
}
